package com.twu.option;

import static com.twu.bean.Movie.SPACE_MARKER;

import java.util.ArrayList;
import java.util.List;

import com.twu.bean.Movie;
import com.twu.util.OptionsUtil;

public class DisplayMoviesOption implements Option
{

	private static List<Movie> allMovies;

	static
	{
		allMovies = new ArrayList<Movie>();
		allMovies.add(new Movie("Sholay", "1975", "Ramesh Sippy", "9"));
		allMovies.add(new Movie("Only God Forgives", "2013", "Nicolas Winding Refn", "9"));
		allMovies.add(new Movie("Venus in Fur", "2012", "Roman Polanski", "8"));
		allMovies.add(new Movie("Prisoners", "2013", " Denis Villeneuve", "8.4"));
		allMovies.add(new Movie("The Town", "2010", "Ben Affleck", "7.6"));
		allMovies.add(new Movie("The Family", "2013", "Luc Besson", "6.5"));
		allMovies.add(new Movie("Training Day", "2001", "Antoine Fuqua", "7.6"));
		allMovies.add(new Movie("Law Abiding Citizen", "2009", "F. Gary Gray", "7.3"));
		allMovies.add(new Movie("Trance", "2013", "Danny Boyle", "7.0"));
		allMovies.add(new Movie("Collateral", "2004", "Michael Mann", "7.6"));
		allMovies.add(new Movie("Inside Man", "2006", "Spike Lee", "7.6"));
		allMovies.add(new Movie("Gravity", "2013", "Alfonso Cuarón", "8.0"));
		allMovies.add(new Movie("In Time", "2011", "Andrew Niccol", "6.6"));
		allMovies.add(new Movie("Europa Report ", "2013", "Sebastián Cordero", "6.5"));
		allMovies.add(new Movie("The Colony", "2013", "Jeff Renfroe", null));
	}

	@Override
	public String execute()
	{
		return title() + OptionsUtil.formattedOutput(allMovies);
	}

	@Override
	public String getTips()
	{
		return "There is no option!";
	}

	@Override
	public Option selectOption(int optionNumber)
	{
		return this;
	}

	public String toString()
	{
		return "Display all movies";
	}

	private String title()
	{
		return "Movie" + SPACE_MARKER + "Year" + SPACE_MARKER + "Director" + SPACE_MARKER + "Rating\n";
	}
}
